// float sdCircle(vec2 uv,float r){
// return length(uv) -r ;
// }
//八角形
// float sdOctogon( in vec2 p, in float r )
// {
//     const vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );
//     p = abs(p);
//     p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
//     p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
//     p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
//     return length(p)*sign(p.y);
// }
//六角星
float sdHexagram( in vec2 p, in float r )
{
    const vec4 k = vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);
    p = abs(p);
    p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
    p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;
    p -= vec2(clamp(p.x,r*k.z,r*k.w),r);
    return length(p)*sign(p.y);
}
// void mainImage(out vec4 fragColor,in vec2 fragCoord){
//     //0,1
//     // vec2 uv = fragCoord.xy/iResolution.xy;
//     // fragColor = vec4(uv,0.0,1.0);
//     //使用uv 画一个四分之一圆
//     // vec2 uv= fragCoord.xy/iResolution.xy;
//     // float d = length(uv);
//     // fragColor = vec4(vec3(d),1);
//      //使用uv 画一个圆
//      vec2 uv= fragCoord.xy/iResolution.xy;
//      uv = (uv - 0.5)*2.0;
//      //自适应圆
//      uv.x *=iResolution.x/iResolution.y;
//     // float d = sdCircle(uv,0.5);
//     // float d = sdOctogon(uv,0.5);
//     float d = sdHexagram(uv,0.3);
//     // vec3 col = vec3(0,0,0);
//     // if(d >0.5){
//     //     col = vec3(1,1,1);
//     // }else{
//     //     col = vec3(1,1,0);
//     // }
//     //step 阶梯函数 ,edge target target > edge返回1,否则返回0
//     //smoothstep平滑过度函数,输入两个边界,边界的差值为过渡区域,可以消除锯齿
//     // float c = step(0.5,d);
//      float c = smoothstep(0.,0.01,d);
//      vec3 color = vec3(c,1,0);
//      fragColor = vec4(color,1.0);
// }
void mainImage(out vec4 fragColor,in vec2 fragCoord){
 //fract 函数可以用来 做重复效果,fract 返回小数部分
 vec2 uv = fragCoord.xy/iResolution.xy;
 //
  uv = fract(uv * vec2(2,2));
 uv = (uv - 0.5)*2.0;
 uv.x*= iResolution.x/iResolution.y;
 float d = sdHexagram(uv,0.5);
 float c = smoothstep (0.,0.01,d);
 fragColor = vec4(vec3(c),1);
}